#pragma once

#include <torch/torch.h>
#include <LibDL/utils.h>


enum class DeviceType : int16_t {
	CPU = 0,
	CUDA = 1, // CUDA.
	MKLDNN = 2, // Reserved for explicit MKLDNN
	OPENGL = 3, // OpenGL
	OPENCL = 4, // OpenCL
	IDEEP = 5, // IDEEP.
	HIP = 6, // AMD HIP
	FPGA = 7, // FPGA
	MSNPU = 8, // MSNPU
	XLA = 9, // XLA / TPU
	// NB: If you add more devices:
	//  - Change the implementations of DeviceTypeName and isValidDeviceType
	//    in DeviceType.cpp
	//  - Change the number below
		COMPILE_TIME_MAX_DEVICE_TYPES = 10,
	ONLY_FOR_TEST = 20901, // This device type is only for test.
};


struct Device {
	using core_type = torch::Device;
	Device(DeviceType ty, size_t num)
		:core(static_cast<torch::DeviceType>(ty), num){}
	Device(const std::string& device_string):core(device_string){}

	Device():core(torch::kCPU,0){}
//	const core_type& _GetCore() const {
//		return core;
//	}
    ENABLE_CAST;

//#if defined(SWIG)
//	%javamethodmodifiers Device::_GetCore "private";
//#endif
private:
	core_type core;
};

